package com.sgb.kjwl.view.ui.adapter.LookingforAJob;

import android.content.Context;
import android.text.TextUtils;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.FindJobEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;
import com.swgk.core.util.DateUtils;
import com.swgk.core.util.MDateUtil;

import java.util.List;

public class FindWorksAdapter extends BaseRecycleAdapter<FindJobEntity> {

    public FindWorksAdapter(Context context, List<FindJobEntity> datas) {
        super(context, R.layout.item_lookingfor_a_job, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final FindJobEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        TextView tvTime = holder.itemView.findViewById(R.id.tv_time);
        TextView tvEndDate = holder.itemView.findViewById(R.id.tv_end_time);
        TextView tvPublishTime = holder.itemView.findViewById(R.id.tv_publish_time);

        tvEndDate.setText(DateUtils.timestampToDate(entity.getEndDate()));
        tvTime.setText(MDateUtil.getStartAndEndDate1(entity.getStartTime(), entity.getEndTime()));
        tvPublishTime.setText(DateUtils.timestampToDate(entity.getCreateTime()) + " 发布");
    }

}
